﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Lists;


namespace KeToanTongHop
{
    public partial class FrmDocTonKhoTuExcel : BasicForms.FrmOKCancel
    {
        public FrmDocTonKhoTuExcel()
        {
            InitializeComponent();
        }

        private void FrmDocTonKhoTuExcel_Load(object sender, EventArgs e)
        {
            if (DesignMode) return;
            #region cmbKho
            cmbKho.DataSource = DanhMucKho.Instance.DataView;
            cmbKho.DisplayColumn = "Ten";
            cmbKho.ValueColumn = "ID";
            cmbKho.AddVisibleColumn("Ma", "Mã", 100, 1);
            cmbKho.AddVisibleColumn("Ten", "Tên",300, 2);
            #endregion
        }


        #region FileName property
        public string FileName
        {
            get
            {
                return txtFileName.Text;
            }
        }
        #endregion

        #region KhoID property
        public Guid KhoID
        {
            get
            {
                return (Guid)cmbKho.EditValue;
            }
        }
        #endregion

        private void btnImportFromTextFile_Click(object sender, EventArgs e)
        {
            openFileDialog.Filter = "Excel file|*.xlsx;*.xls";
            openFileDialog.InitialDirectory = "C:";
            openFileDialog.Title = "Chọn file excel đúng định dạng";
            DialogResult result = openFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                txtFileName.Text = openFileDialog.FileName;
            }
        }
    }
}
